/**
 * 发送消息给worker
 */
interface SendWorkerMessage<T = any> {
  readonly type: 'send'
  readonly data?: T
}

/**
 * 接收来自worker的消息
 */
interface ReplyWorkerMessage<T = any> {
  readonly type: 'success'
  readonly data: T
}

/**
 *  转码worker发送的数据
 */
interface ProcessorWorkerSendWorkerData {
  uuid: string
  original: Float32Array
}

/**
 * 转码worker发送的消息
 */
type ProcessorWorkerSendWorkerMessage = SendWorkerMessage<ProcessorWorkerSendWorkerData>

/**
 * 转码worker接收的消息
 */
type ProcessorWorkerReplyWorkerMessage = ReplyWorkerMessage<{
  audioData: Array<number>
  uuid: string
}>

export type {
  ProcessorWorkerReplyWorkerMessage,
  ProcessorWorkerSendWorkerData,
  ProcessorWorkerSendWorkerMessage,
  ReplyWorkerMessage,
  SendWorkerMessage,
}
